import request from '@/utils/myRequest'

// 分页查询商品列表
function productsByPage(start, limit, data) {
  return request({
    url: `/lejuAdmin/product/productsByPage/${start}/${limit}`,
    method: 'POST',
    data
  })
}
// 添加商品信息 POST
function addProductAndSkus(data) {
  return request({
    url: '/lejuAdmin/product/addProductAndSkus',
    method: 'POST',
    data
  })
}
// 删除商品信息
function delProductAndSkus(productId) {
  return request({
    url: `/lejuAdmin/product/del/${productId}`,
    method: 'DELETE'
  })
}
// 更新商品信息
function updateProductAndSkus(data) {
  return request({
    url: `/lejuAdmin/product/updateProductAndSkus`,
    method: 'POST',
    data
  })
}
// 查询商品详情 用于修改
function productSkusDetail(productId) {
  return request({
    url: `/lejuAdmin/product/productSkusDetail/${productId}`
  })
}
// 更改是否最新
function switchNewStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchNewStatus',
    method: 'POST',
    data
  })
}
// 更改是否预告
function switchPreviewStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchPreviewStatus',
    method: 'POST',
    data
  })
}
// 更改发布状态
function switchPublishStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchPublishStatus',
    method: 'POST',
    data
  })
}
// 更改是否推荐
function switchRecommandStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchRecommandStatus',
    method: 'POST',
    data
  })
}
// 更改审核状态
function switchVerifyStatus(data) {
  return request({
    url: '/lejuAdmin/product/switchVerifyStatus',
    method: 'POST',
    data
  })
}
export { productsByPage, addProductAndSkus, delProductAndSkus, switchVerifyStatus, switchRecommandStatus, switchPublishStatus, switchPreviewStatus, switchNewStatus, productSkusDetail, updateProductAndSkus }
